package panda.client.listeners;

import panda.client.Cardpanda;
import panda.client.ui.widgets.ZoomManager;

import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;

/**
 * Temporary class before Mouselisteners are converted to use event.isShiftKeyDown() from the new API. Although, this
 * class might have to stay because of the zoom behavior, which stops zooming when 'Z' is released.
 * 
 * @author zane.tian@gmail.com
 */
public class PandaKeyUpHandler implements KeyUpHandler {

	public void onKeyUp(KeyUpEvent event) {
		int keyCode = event.getNativeKeyCode();

		if(keyCode == KeyCodes.KEY_SHIFT) {
			PandaKeyDownHandler.holdingShift = false;
		}
		
		if(keyCode == KeyCodes.KEY_CTRL) {
			PandaKeyDownHandler.holdingCtrl = false;
		}

		ZoomManager zoom = Cardpanda.zoomManager;
		if(keyCode == 'Z') {
			zoom.hide();
		}
	}
}
